The present disclosure relates to a computer graphics system, and more particularly, to rendering images including objects at different depths.
A computer graphics system may render an image based on multiple objects from a perspective of a camera. As in the real world, when virtual objects are viewed from a particular perspective, other objects may block (or occlude) the view of all or a portion of the object. Generally, a closer object will occlude a more distant object. In a computer graphics system, overdraw occurs when a closer object is drawn using pixels that already include another object. The existing pixels are replaced with pixels for the closer object. Generally, overdrawing is considered wasteful because the properties of each overdrawn pixel are determined multiple times, using additional processing resources.
One solution to reduce or eliminate overdraw is the use of a depth pre-pass, which is available on modern graphics processing units (GPU). In this scheme each object is rendered twice. In the first iteration, only the per-pixel nearest depth is recorded to the depth buffer. In the second iteration, only the nearest object will pass the depth buffer test and write pixel data. This avoids overdraw, but at the expense of processing every object twice. This expense can sometimes outweigh the benefit of eliminating overdraw resulting in a net loss.
Another solution to reducing overdraw is to perform a low resolution occlusion render, typically using the central processing unit (CPU). Low resolution occlusion geometry is rendered to an occlusion buffer, for example, a box for a building or rectangles for a wall or fence. This occlusion render is used to test a single bounding volume for each object, typically a box. If the entire bounding box is occluded, the software may prevent rendering of the object. Often, however, objects may be only partially occluded, so software occlusion render may still render the entire object, resulting in rendering many pixels that are occluded and which are later overdrawn.
Thus, there is a need in the art for improvements in graphics processing for determining whether to render pixels.